<h1><?php echo $this->title;?></h1>
<br/>
<br/>
<?php
 echo $this->form;
 ?>
 <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
 <script type="text/javascript">
	$(function()
		{
			$("input").blur(function()
					{
						var formElementId = $(this).parent().prev().find('label').attr('for');
						doValidation(formElementId);
					});
		}
	);
	function doValidation(id)
	{
		var url = '/zfMHB/public/admin/thechinh/validateform/';
		var data = {};
		$("input").each(function()
				{
					data[$(this).attr('name')] = $(this).val();
				}
				);
		$.post(url,data,function(resp)
				{
					$("#"+id).parent().find(".errors").remove();
					$("#"+id).parent().append(getErrorHtml(resp[id], id));
				},'json');
	}
	function getErrorHtml(formErrors, id)
	{
		var o = '<ul id="'+id+'"class="errors">';
		for(errorKey in formErrors)
		{
			o += '<li>' + formErrors[errorKey] + '</li>';
		}
		o += '</ul>';
		return o;
	}
 </script>